// 品牌管理接口
import  request  from '@/utils/request'
import type { TrademarkResponseData, Trademark } from './type'
enum API {
  // 获取已有品牌接口
  TRADEMARK_URL = '/admin/product/baseTrademark/',
  // 添加品牌
  ADDTRADEMARK_URL = '/admin/product/baseTrademark/save',
  // 修改品牌
  UPDATETRADEMARK_URL = '/admin/product/baseTrademark/update',
  DELETETRADEMARK_URL = '/admin/product/baseTrademark/remove/'
}


// 获取已有品牌接口
export const reqHasTrademark = (page:number, limit:number) => request.get<any, TrademarkResponseData>(API.TRADEMARK_URL+`${page}/${limit}`)


// 添加与修改品牌
export const reqAddOrUpdateTrademark = (data:Trademark ) => {
  if(data.id) {
    // 修改
    return request.put<any, any>(API.UPDATETRADEMARK_URL,data)
  } else {
    return request.post<any, any>(API.ADDTRADEMARK_URL,data)
  }
}

// 删除已有品牌
export const reqDeleteTrademark = (id:number) => request.delete<any,any>(API.DELETETRADEMARK_URL+`${id}`)



